import java.util.LinkedList;
import java.util.List;


public class knoten {
	
	int id;
	int capacity;
	java.util.List<knoten> nachfolger;
	java.util.List<knoten> vorganger;
	
	public knoten(int id, int cap){
		this.id = id;
		this.capacity = cap;
		nachfolger = new LinkedList<knoten>();
		vorganger = new LinkedList<knoten>();
	}

	public void nfadd(knoten nf){
		if (nf==null)throw new IllegalArgumentException("nachfolger null");
		this.nachfolger.add(nf);
	}
	
	public void vgadd(knoten vg){
		if (vg==null)throw new IllegalArgumentException("vorganger null");
		this.vorganger.add(vg);
	}
	
	public List<knoten> nfget(){
		return this.nachfolger;
	}

	@Override
	public int hashCode() {
		return capacity + id;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		knoten other = (knoten) obj;
		if (capacity != other.capacity)
			return false;
		if (id != other.id)
			return false;
		return true;
	}
	
	
	
}
